﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" ValidateRequest="false" CodeBehind="Purchases.aspx.cs" Inherits="CreateReservations.Purchases" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="myLbl">
        <asp:Label ID="searchLbl" runat="server" Text="Purchase ID: "></asp:Label>
    </div>
    <div class="myTxt2">
        <asp:TextBox ID="searchTxt" runat="server"></asp:TextBox>
        <asp:RangeValidator ID="RangeValidatorMinPrice" runat="server"
                    ErrorMessage="Invalid purchase Id" 
                    ControlToValidate="searchTxt"
                    Display="Dynamic"
                    ValidationGroup = "myGroup"
                    ForeColor="Red"
                    Type="Integer"
                    MinimumValue="0"
                    MaximumValue="999999999">
                 </asp:RangeValidator></div>  
    <br />
    <br />
    <div class="myLbl">
        <asp:Label ID="Label1" runat="server" Text="Status: "></asp:Label>
    </div>
    <div class="myTxt">
        <asp:DropDownList ID="statusDDL" runat="server">
        </asp:DropDownList>
    </div>
    <div class="myButton">
        <asp:LinkButton ID="searchLB" runat="server" onclick="searchLB_Click">Search</asp:LinkButton>
    </div>
    <br />
    <asp:Repeater ID="reservRepeater" runat="server" >
        <ItemTemplate>
            <div class="itemTemp">
                <div class="info">
                    <b>Purchase Id: <%# Eval("ReservationId") %></b>
                    <br />
                    Customer Name: <%# Server.HtmlEncode(Eval("CustomerName").ToString())%>
                    <br />
                    Purchase date and time: <%# Eval("PurchaseDate", "{0:dd/MM/yyyy hh-mm tt }")%>
                    <br />
                    Number of tickets:  <%# Eval("NumberOfTickets") %>                        
                    <br />
                    Shipping address: <%# Server.HtmlEncode(Eval("ShippingAddress").ToString()) %>
                    <br />
                    Event title: <%# Server.HtmlEncode(Eval("Event.Title").ToString()) %>
                    <br />
                    Total Price: <%# string.Format("{0:c}", Convert.ToDecimal(Eval("NumberOfTickets").ToString()) * Convert.ToDecimal(Eval("Event.Price")))%>
                    <br />
                    Status: <%# Server.HtmlEncode(Eval("ReservationStatuse.StatusName").ToString())%>
                    <br />
                </div>

                <div class="buttons">
                    <div class="button">
                        <asp:LinkButton ID="myLB" runat="server" CommandArgument='<%# Eval("ReservationId") %>' onclick="myBtn_click" >Change Status</asp:LinkButton>
                    </div>
                </div>   
            </div>  
        </ItemTemplate>
    </asp:Repeater>  

    <asp:Repeater ID="rptPages" Runat="server" onitemcommand="rptPages_ItemCommand">
        <HeaderTemplate><h4>Page:</h4></HeaderTemplate>
        <ItemTemplate>
            <div class="catTemp">
                 <asp:LinkButton ID="btnPage"
                                 CommandName="Page"
                                 CommandArgument="<%#
                                 Container.DataItem %>"
                                 CssClass="text"
                                 Runat="server"><%# Container.DataItem %>
                                 </asp:LinkButton>&nbsp;
            </div>
        </ItemTemplate>
      </asp:Repeater>
</asp:Content>
